<? 
		if(isset($_POST['btnsubmit']))
		{
			require("required/dbconnect.php"); 
			
			$content_eng=$_POST['content_eng'];
			$title_eng=mysql_escape_string($_POST['title_eng']);
			
			$create_date=$_POST['create_date'];
			$status=$_POST['status'];
			$type=$_POST['type'];
			
			
			$insert=mysql_query("insert into os_news(content_eng,title_eng,create_date,status,type)value('$content_eng','$title_eng','$create_date','$status','$type')")or die(mysql_error());
			header("Location:events.php?type=$type");
?>
			
<?			
		
		}
		else
		{
				require("required/dbconnect.php"); 
				require("required/function.php");
				require("required/header.php");
				
				checkAccess("allow_content_management",1); 
				if(empty($_GET['type']))
				{
					$type=2;
				}else{
				
					$type=$_GET['type'];
				}
				
				if($type==2)
				{
					$title="News and Events";
				}else{
					$title="Information";
				}
				
?>
				
				<table width="100%"  cellpadding="0" cellspacing="5" height="300">
				<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
				</script>
				<script type="text/javascript" src="required/js/calendarDateInput.js"></script>		
					
					<td width="100%" align="left" valign="top">
					
						<form action="<?= $_SERVER['PHP_SELF'] ?>" name="frm" method="post" onSubmit="return validatefrm(this)">
						<table width="100%">
						
						<td class="title" colspan="3">
						Add <?= $title ?>
						
						
						
						</td>
						<tr>
							<td>Date</td><td>:</td><td><script>DateInput('create_date', true, 'YYYY-MM-DD')</script></td>
						</tr>
						<tr>
							<td>Show</td><td>:</td><td><select name="status" class="text"><option value="1">Yes</option><option value="0">No</option></select></td>
						</tr>
						<input type="hidden" value="<?= $type ?>" name="type">
							
						
						
						<tr>
							<td>Title</td><td>:</td><td><input class="text" type="text" name="title_eng" size="30" value="" maxlength="200"></td>
						</tr>
						
						<tr valign="top">
							<td width="8%">Content </td>
						  <td width="0%">:</td>
			  <td width="92%" valign="top">
								<? include_once("fckeditor/fckeditor.php") ?>
							<?php
								$oFCKeditor = new FCKeditor('content_eng') ;
								$oFCKeditor->ToolbarSet = 'DeswinBasic';
								$oFCKeditor->BasePath = './fckeditor/' ;
								$oFCKeditor->Value = "" ;
								$oFCKeditor->Create() ;
							?>							</td>
						</tr>
							
						
						<tr>
							<td colspan="3">
                            <input type="submit" value="Submit" name="btnsubmit" class="button">
                            <input type="button" value="Back" onclick="history.go(-1)">
                            </td>
						</tr>
						</table>
						</form>
					</td>
				 
				</table>
<? }require("required/footer.php"); ?>